<template>
	<view class="content">
			<view v-for="(item,index) in answerList" :key="index" class="pg-item"  >
				<view class="pg-content">
					<view class="pg-view">
						<text class="pg-title">试题:{{item.questionstitle}}</text>
					</view>
					<view class="pg-view">
						<text class="pg-title">答题时间:{{item.answertime}}</text>
					</view>
					<!-- <view class="pg-view">
					<text v-if="item.correctflag=='2'" class="attr_tag attr_tag-danger">已批改</text>
					</view> -->
					<view class="bot b-t" @click="pgClick(item)">
						<text>查看详情</text>
						<text class="more-icon yticon icon-you"></text>
					</view>
				</view>
		
		</view>
		
	</view>

	
</template>
<script>


	import discussMarkApi from "@/api/subjectiveCase.js"

	let _this
	export default {
		components: {
		
		},
		onLoad(query) {
			_this = this;
			_this.query = query;
			_this.initData()
		},
		data() {
			return {
				answerList: [],
				page: 1,
				pagenum: 20,
				count: 0,
				query: {},
				
				loading: false, //是否处于读取状态
				paused: true, //是否处于暂停状态
				seek: false //是否处于拖动状态
			};
		},

		computed: {

		},
		onReachBottom(e) {
			console.log(e)
			if (_this.count == _this.answerList.length) {
				return
			}
			_this.page = _this.page + 1
			_this.initData()
		},
		methods: {
			pgClick(item) {
				let id = item.id
				uni.navigateTo({
					url: '/pages/discussMark/user-answer-detail?id=' + id
				})
			},
			initData() {
				let {
					usercode
				} = uni.getStorageSync('user')
				let {
					teacode
				} = _this.query
				let data = {
					usercode: usercode,
					teacode: teacode,
					page: _this.page,
					pagenum: _this.pagenum,
					type:2
				}
				discussMarkApi.brst(data).then(res => {
					console.log(res)
					_this.count = res.data.count
					res.data.list = res.data.list || []

					_this.answerList = _this.answerList.concat(res.data.list)
				}).catch(err => {
					console.log(err)
				})
			},
			
		},

		onReady() {}
	};
</script>
<style lang="scss">
	page,
	.content {
		background: $page-color-base;
		height: 100%;
	}
	.pg-item {
		display: flex;
		flex-direction: column;
		align-items: center;
		width: 100%;
		.time {
			display: flex;
			align-items: center;
			justify-content: center;
			height: 80upx;
			padding-top: 10upx;
			font-size: 26upx;
			color: #7d7d7d;
		}
		
		.pg-content{
			width: 100%;
			padding: 0 30upx  0 30upx;
			background-color: #fff;
			border-radius: 4upx;
			margin-top:16upx;
		}
		.pg-view{
			padding:10upx 0 ;
			.pg-title {
				display: flex;
				align-items: center;
				// height: 50upx;
				font-size: 30upx;
				color: #303133;
				
			}
		}
		
		
		.bot {
			display: flex;
			align-items: center;
			justify-content: space-between;
			height: 80upx;
			font-size: 24upx;
			color: #707070;
			position: relative;
		}
		
		.more-icon {
			font-size: 32upx;
		}
	}
	.attr_tag{
		font-size: $font-sm + 2upx;
		line-height: 50upx;
		color: #fff;
		
		border-radius: 0 30upx 30upx 0 ;
		margin: 0 0upx;
		padding: 0 10upx;
	}
	.attr_tag-danger{
		background-color: #fb4b6c;
	}
	.attr_tag-primary{
		background-color:  #007aff;
	}
</style>
